package com.androidx.p013lv.mine.adapter;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.androidx.p013lv.base.bean.VideoHistory;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.base.utils.TimeUtils;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.mine.C1207R;

/* renamed from: com.androidx.lv.mine.adapter.MineHistoryVideoAdapter */
public class MineHistoryVideoAdapter extends BaseRecyclerAdapter<VideoHistory, Holder> {
    private String domain;

    public void setDomain(String str) {
        this.domain = str;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((VideoHistory) getDataInPosition(i));
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(C1207R.C1212layout.item_mine_history_video, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.androidx.lv.mine.adapter.MineHistoryVideoAdapter$Holder */
    public class Holder extends BaseRecyclerHolder {
        ImageView img_select;
        ImageView iv_cover;
        ImageView iv_original = ((ImageView) this.itemView.findViewById(C1207R.C1210id.iv_original));
        ImageView iv_pay = ((ImageView) this.itemView.findViewById(C1207R.C1210id.iv_pay));
        ImageView iv_vip = ((ImageView) this.itemView.findViewById(C1207R.C1210id.iv_vip));
        RelativeLayout root_view;
        TextView tv_progress;
        TextView tv_score;
        TextView tv_time;
        TextView tv_title;

        Holder(View view) {
            super(view);
            this.root_view = (RelativeLayout) view.findViewById(C1207R.C1210id.root_view);
            this.iv_cover = (ImageView) view.findViewById(C1207R.C1210id.iv_cover);
            this.img_select = (ImageView) view.findViewById(C1207R.C1210id.img_select);
            this.tv_score = (TextView) view.findViewById(C1207R.C1210id.tv_score);
            this.tv_time = (TextView) view.findViewById(C1207R.C1210id.tv_time);
            this.tv_title = (TextView) view.findViewById(C1207R.C1210id.tv_title);
            this.tv_progress = (TextView) view.findViewById(C1207R.C1210id.tv_progress);
        }

        /* access modifiers changed from: package-private */
        public void setData(VideoHistory videoHistory) {
            if (videoHistory.getEditState() == 0) {
                this.root_view.setPadding(UiUtils.dp2px(4), 0, 0, 0);
                this.img_select.setVisibility(8);
            } else if (videoHistory.getEditState() == 1) {
                this.root_view.setPadding(UiUtils.dp2px(10), 0, UiUtils.dp2px(-8), 0);
                this.img_select.setImageResource(C1207R.C1209drawable.mine_btn_edit_un_select);
                this.img_select.setVisibility(0);
            } else {
                this.root_view.setPadding(UiUtils.dp2px(10), 0, UiUtils.dp2px(-8), 0);
                this.img_select.setImageResource(C1207R.C1209drawable.mine_btn_edit_select);
                this.img_select.setVisibility(0);
            }
            if (!TextUtils.isEmpty(videoHistory.getCoverImg())) {
                GlideUtils.loadCropRadius(MineHistoryVideoAdapter.this.domain + videoHistory.getCoverImg(), 4, this.iv_cover);
            } else {
                GlideUtils.loadCropRadiusDefault(4, this.iv_cover);
            }
            TextView textView = this.tv_score;
            textView.setText(videoHistory.getScore() + "分");
            this.tv_time.setText(TimeUtils.stringForTime(videoHistory.getPlayTime() * 1000));
            this.tv_title.setText(videoHistory.getTitle());
            TextView textView2 = this.tv_progress;
            textView2.setText(videoHistory.getProgress() + "%");
            this.iv_vip.setVisibility(8);
            this.iv_pay.setVisibility(8);
            if (videoHistory.getVideoType() == 1) {
                this.iv_vip.setVisibility(0);
            } else if (videoHistory.getVideoType() == 2) {
                this.iv_pay.setVisibility(0);
            }
            if (videoHistory.getSelfMade()) {
                this.iv_original.setVisibility(0);
            } else {
                this.iv_original.setVisibility(8);
            }
        }
    }
}
